package com.qys.livesMall.system.controller.app;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.system.model.dto.sys.H2ChannelDTO;
import com.qys.livesMall.system.model.entity.H2Channel;
import com.qys.livesMall.system.service.SysH2ChannelService;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/channel")
public class AppH2ChannelController {

    @Resource
    private SysH2ChannelService sysH2ChannelService;

    @GetMapping("/getCountry")
    @Operation(description = "通道国家列表")
    public R getCountry() {
        return R.ok(sysH2ChannelService.getCountry());

    }

    @GetMapping("/list/{countryId}")
    @Operation(description = "通道列表")
    public R listChannel(@PathVariable("countryId") Long countryId) {
        LambdaQueryWrapper<H2Channel> query = Wrappers.lambdaQuery(H2Channel.class)
                .eq(H2Channel::getStatus, 1)
                .eq(H2Channel::getCountryId,countryId);
        return R.ok(sysH2ChannelService.list(query));

    }
}
